Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Programmer's Overview / Part 1 - Getting Started With QuickDraw GX
Chapter 2 - A Quick & Easy Sample Program


Creating and Drawing a Curve

QuickDraw GX provides three common methods to create and draw a curve:

The first method is the simplest. You can draw a curve with a single
function call:

GXDrawCurve(ff(40), ff(120), 
            ff(100), ff(0), 
            ff(200), ff(120));
(The parameters to the GXDrawCurve function specify the coordinates of the curve. The section "Setting the Geometry of the Curve" on page 45 explains these coordinates and the purpose of the ff macro in detail.)

The function call results in the curve shown in Figure 2-1.

Figure 2-1 A curve

A second way to draw the same curve is to create a curve shape using the GXNewCurve function and then draw the curve shape using the GXDrawShape function. Here is the code:

shape myCurve;

myCurve = GXNewCurve(ff(40), ff(120), 
                     ff(100), ff(0), 
                     ff(200), ff(120));
GXDrawShape(myCurve);
The following sections in this chapter use the third method; they show how you can create a curve shape using the GXNewShape function, modify the curve shape, draw the curve shape to a Macintosh window, print the curve shape, and examine the curve shape using the GraphicsBug debugger.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help